load(
    "//tools:defaults.bzl",
    "extract_tokens",
    "markdown_to_html",
    "ng_project",
    "ng_web_test_suite",
    "sass_binary",
    "sass_library",
)

package(default_visibility = ["//visibility:public"])

sass_library(
    name = "m3",
    srcs = [
        "_m3-list.scss",
    ],
    deps = [
        "//src/material/core/style:sass_utils",
        "//src/material/core/tokens:m3_utils",
    ],
)

sass_library(
    name = "m2",
    srcs = [
        "_m2-list.scss",
    ],
    deps = [
        "//src/material/core/style:elevation",
        "//src/material/core/style:sass_utils",
        "//src/material/core/theming:_inspection",
        "//src/material/core/tokens:m2_utils",
    ],
)

sass_library(
    name = "theme",
    srcs = [
        "_list-theme.scss",
    ],
    deps = [
        ":m2",
        "//src/material/checkbox:m2",
        "//src/material/core/style:sass_utils",
        "//src/material/core/theming",
        "//src/material/core/theming:_inspection",
        "//src/material/core/theming:_validation",
        "//src/material/core/tokens:token_utils",
        "//src/material/core/typography",
        "//src/material/radio:m2",
    ],
)

sass_binary(
    name = "css",
    src = "list.scss",
    deps = [
        ":list_inherited_structure",
        ":list_item_hcm_indicator",
        ":m2",
        "//src/material/core/style:layout_common",
        "//src/material/core/tokens:token_utils",
    ],
)

sass_library(
    name = "list_item_hcm_indicator",
    srcs = ["_list-item-hcm-indicator.scss"],
    deps = ["//src/cdk:sass_lib"],
)

sass_library(
    name = "list_inherited_structure",
    srcs = ["_list-inherited-structure.scss"],
    deps = [
        ":m2",
        "//src/material/core/style:vendor_prefixes",
        "//src/material/core/tokens:token_utils",
    ],
)

sass_binary(
    name = "option_css",
    src = "list-option.scss",
    deps = [
        ":list_item_hcm_indicator",
        "//src/material/checkbox:checkbox_common",
        "//src/material/radio:radio_common",
    ],
)

ng_project(
    name = "list",
    srcs = [
        "action-list.ts",
        "index.ts",
        "list.ts",
        "list-base.ts",
        "list-item-sections.ts",
        "list-module.ts",
        "list-option.ts",
        "list-option-types.ts",
        "nav-list.ts",
        "public-api.ts",
        "selection-list.ts",
        "subheader.ts",
        "tokens.ts",
    ],
    assets = [
        "list-item.html",
        "list-option.html",
        ":css",
        ":option_css",
    ],
    deps = [
        "//:node_modules/@angular/common",
        "//:node_modules/@angular/core",
        "//:node_modules/@angular/forms",
        "//:node_modules/rxjs",
        "//src:dev_mode_types",
        "//src/cdk/coercion",
        "//src/cdk/collections",
        "//src/cdk/observers",
        "//src/cdk/private",
        "//src/material/core",
        "//src/material/divider",
    ],
)

ng_project(
    name = "list_tests_lib",
    testonly = True,
    srcs = glob(
        ["**/*.spec.ts"],
    ),
    deps = [
        ":list",
        "//:node_modules/@angular/core",
        "//:node_modules/@angular/forms",
        "//:node_modules/@angular/platform-browser",
        "//src/cdk/keycodes",
        "//src/cdk/testing/private",
        "//src/cdk/testing/testbed",
        "//src/material/core",
    ],
)

ng_web_test_suite(
    name = "unit_tests",
    deps = [
        ":list_tests_lib",
    ],
)

markdown_to_html(
    name = "overview",
    srcs = [":list.md"],
)

extract_tokens(
    name = "tokens",
    srcs = [":theme"],
)

filegroup(
    name = "source-files",
    srcs = glob(["**/*.ts"]),
)
